<?php 
    header("Content-type: text/html; charset=utf-8");
    require_once('auth_i.inc.php');
    require_once('backup.inc.php');

    $info = TRUE;

    if (!empty($_FILES) && ($_FILES['file']['error'] == 0) && (is_uploaded_file($_FILES['file']['tmp_name'])))
    {
        $info = save_backup_file($_FILES['file']['tmp_name']);
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
    <title>Управление архивами.</title>
    <?php
        require_once('headers.inc.php');
    ?>
    <script src="backup.js" type="text/javascript"></script>

    <script type="text/javascript">

    var backup_path="<?php echo $path ?>";
    var database="<?php echo $database ?>";


    <?php
        if ($info === FALSE)
        {
            echo ('alert("Неправильный формат файла ! \nВозможно неверная версия архива !");');
        }
    ?>

    </script>

</head>
<body>
<?php // menu bar
    require_once('menu.inc.php');

    print menu($menu_items, 'backup.php');
?>

<div id="upload-form" title="Загрузить архив">
    <form id="post-form" enctype="multipart/form-data" action="backup.php" method="post" class="FormGrid">
        <table id = "backup-form-table">
            <tr>
                <td id="label">    
                    <label for="file">Файл архива:</label>
                </td>
                <td id="data">   
                    <input type="file" name="file" id="file" value="" class="FormElement ui-widget-content ui-corner-all"/>    
                </td>    
            </tr>    
        </table>            
    </form>
</div>

<div id="right-info" >
    <button id="backup-button">Архивировать</button>
    <button id="restore-button">Восстановить</button>
    <button id="del-button">Удалить архив</button>
    <button id="arch-upload-button">Загрузить архив</button>
    <button id="download-button">Выгрузить архив</button>
</div>

<div id="content" style="bottom:0">
<table id="list"></table> 
</div>

</body>
</html>
